import sys
import os
import pytest
# run.py
import os
import pytest

current_directory = os.getcwd()
relative_path = 'Xuntian/testcase'
new_path = os.path.join(current_directory, relative_path)
os.chdir(new_path)

if __name__ == '__main__':
    pytest.main(['test_add_fault.py'])
# 接下来你可以调用pytest.main()或者使用其他方式运行你的测试
# if __name__ == '__main__':
#     pytest.main(['-vs','--rootdir=Xuntian/testcase',r'C:\Users\shiping.zheng\Desktop\Demo\TestDemo\Xuntian\testcase\test_faultcode_manage.py'])
    # pytest.main(['-v', '--rootdir=Xuntian/testcase', 'test_faultcode_manage.py'])
    # """此时生成的报告文件为json格式"""
    # # pytest.main(['-vs', r'C:\Users\admin\PycharmProjects\pythonProject\Xuntian\TestDemo.py',"--alluredir","./report"])
    # pytest.main(['-vs', "--alluredir", "./report"])
    # '执行成功后生成的报告为一个json格式的文件，此时我们需要将json格式转换成html格式'
    # os.system('allure generate ./report/ -o ./report/html/ --clean-alluredir')
    # '执行成功后，可生成index.html文件'
    # os.system("allure open ./report/html/")
    # pytest.main(['-vs',r'C:\Users\admin\PycharmProjects\Flag\testcase\test_task.py', r'C:\Users\admin\PycharmProjects\Flag\testcase\test_powerPwNew.py',r'C:\Users\admin\PycharmProjects\Flag\testcase\test_paychallengeMoney.py'])
    # pytest.main(['-vs',r'C:\Users\admin\PycharmProjects\Flag\testcase\test_task.py',"--alluredir","./allureReport"])
    # os.system('allure generate ./allureReport -o ./allureReport/reportHtml --clean'/